package com.mjlf.mqzook.advice;

import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @ClassName ExceptionAdvice
 * @Author mjlft
 * @Date 2020/2/18 12:57
 * @Version 1.0
 * @Description TODO
 */
@ControllerAdvice(basePackages = "com.mjlf.mqzook.controller")
public class ExceptionAdvice {
    @ExceptionHandler(Exception.class)
    @ResponseBody
    public JSONObject advice(Exception e){
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("code", 500);
        return jsonObject;
    }
}
